<?php
Yii::import('zii.widgets.CLinkPager');

class CustomPager extends CLinkPager{
    

        public $buttonTemplate = '_button';
        
        public $pagerText = 'More';
        
        public function init() {
            parent::init();
            
            $this->nextPageLabel = Yii::t('translation', $this->pagerText);
            $this->header = '';
        }

        public function run(){
            $this->registerClientScript();
            $buttons = $this->createPageButtons();
            if(empty ($buttons))
                return;
            foreach($buttons as $button){
                echo $button;
            }
                
        }

        protected function createPageButtons()
        {
                if(($pageCount=$this->getPageCount())<=1)
                        return array();

                list($beginPage,$endPage)=$this->getPageRange();
                $currentPage=$this->getCurrentPage(false); // currentPage is calculated in getPageRange()
                $buttons=array();
                if(($page=$currentPage+1)>=$pageCount-1)
                        $page=$pageCount-1;
                $buttons[]=$this->createPageButton($this->nextPageLabel,$page,self::CSS_NEXT_PAGE,$currentPage>=$pageCount-1,false);

                return $buttons;
        }
        
        protected function createPageButton($label,$page,$class,$hidden,$selected)
        {
                if($hidden || $selected)
                        $class.=' '.($hidden ? self::CSS_HIDDEN_PAGE : self::CSS_SELECTED_PAGE);
                return '<a href="'.$this->createPageUrl($page).'" class="'.$class.'">'.$label.'</a>';
        }

}